'''
@author Aurelien Deharbe

This file is part of Cute-Client.

Cute-Client is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Cute-Client is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with Cute-Client.  If not, see <http://www.gnu.org/licenses/>.
'''

import sys
from cuteclient.csclient import CSClient

c = CSClient('localhost', 5000)
s = c.newSession("example03")

window = s.qs("QWidget() -> window")
s.qs("<window>.resize(200, 120)")
quit = s.qs("QPushButton('Quit', <window>) -> quit")
s.qs("<<window>.<quit>>.setFont(QFont('Times', 18, QFont.Bold))")
s.qs("<<window>.*>.setGeometry(10, 40, 180, 40)")

def quit_clicked(sender):
    sys.exit(0)
s.registerCallback("<quit>", "clicked", quit_clicked)

s.qs("<window>.show()")
s.mainloop()
